/*
 * @Description:定义表单校验规则
 * @Author: HYH
 * @LastEditors: HYH
 * @LastEditTime: 2022-08-29 17:20:50
 */

type ITrigger = 'change' | 'blur'
export interface RuleItem {
  require: boolean
  trigger: ITrigger[]
  message?: string
  validator?: (rule: RegExp, value: string, callback: Function) => void
}
export type IRule = {
  /**请选择 */
  pleaseSelect?: RuleItem[]
}

/**使用表单校验规则 */
const useRule = () => {
  /** 表单校验规则 */
  const Rules: IRule = {
    /**请选择 */
    pleaseSelect: [{ require: true, message: lang('elMsg.plzSelect'), trigger: ['blur', 'change'] }]
  }
  return Rules
}
export default useRule
